package Utils;

import android.graphics.Color;
import android.os.CountDownTimer;
import android.widget.TextView;

public class TimeCount extends CountDownTimer {

    private TextView txt;

    public TimeCount(TextView txt, long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.txt = txt;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        txt.setBackgroundColor(Color.parseColor("#FFFFFF"));
        txt.setClickable(false);
        txt.setText("(" + millisUntilFinished / 1000 + ") 秒后可重新发送");
    }

    @Override
    public void onFinish() {
        txt.setText("重新获取验证码");
        txt.setClickable(true);
        txt.setBackgroundColor(Color.parseColor("#0CA6F0"));

    }

}
